import pygame

class Card(object):
    def __init__(self, shortTitle, title, code, img):
        self.shortTitle=shortTitle
        self.title=title
        self.code=code#self.img[:-4]
        self.img=img
        self.rImg=None
        self.rect=None

    def __str__(self):
        return self.__repr__()
    def __repr__(self):
        return 'Card("%s","%s","%s","%s")'%(self.shortTitle,self.title,self.code,self.img)

    def loadImage(self):
        #print "!"*4,"LOADING: ",self.img
        cardFile = "images/"+self.img
        #print "OPENIGN %s"%cardFile
        newImage = pygame.image.load(cardFile).convert()
        oRect=newImage.get_rect()
        nw,nh=(200,250)
        if oRect.width>oRect.height: nw,nh=nh,nw
        newImage = pygame.transform.smoothscale(newImage,(nw,nh)).convert()
        self.rImg=newImage
        self.rect=self.rImg.get_rect()
        #screen.blit(newImage,(x,y))
        pass


    def setPos(self,x,y):
        self.rect.top=y
        self.rect.left=x
    def draw(self,surface):
        surface.blit(self.rImg,self.rect)

    
class Situation(Card):
    def __init__(self, shortTitle, title, code,img):
        Card.__init__(self,shortTitle,title, code,img)

class Hazard(Card):
    def __init__(self, shortTitle, title, code,img):
        Card.__init__(self,shortTitle,title, code,img)

class Action(Card):
    def __init__(self,shortTitle,title,code,img):
        Card.__init__(self,shortTitle,title, code,img)
 
